package com.hand.demo.api.controller.v1;

import org.hzero.boot.scheduler.api.dto.ChildJobDTO;
import org.hzero.boot.scheduler.infra.annotation.JobHandler;
import org.hzero.boot.scheduler.infra.enums.ReturnT;
import org.hzero.boot.scheduler.infra.handler.IJobHandlerAllowStop;
import org.hzero.boot.scheduler.infra.tool.SchedulerTool;

import java.util.Map;

@JobHandler("demo1")
public class DemoTestJob implements IJobHandlerAllowStop {
    @Override
    public ReturnT execute(Map<String, String> map, SchedulerTool tool) {
        ChildJobDTO dto=new ChildJobDTO();
        dto.setTenantId(0L);
        dto.setExecutorCode("DEMO_EXECUTOR");
        dto.setCycleFlag(1);
        dto.setExecutorStrategy("POLLING");
        dto.setFailStrategy("IGNORE");
        dto.setGlueType("SIMPLE");
        dto.setJobCode("GQS_DEMO");
        dto.setJobHandler("demo2");
        dto.setParentId(881L);
        tool.addChildJob(dto);
        return ReturnT.SUCCESS;
    }
}
